import http from '@/utils/http'
import { defineStore } from 'pinia'
export const useAllinpayStore = defineStore('allinpay', {
  state: () => {
    return {
      paySettlementType: 0 // 是否启用通联支付 0:不启用 1:启用
    }
  },
  actions: {
    SET_PAY_SETTLEMENT_TYPE (paySettlementType) {
      this.paySettlementType = paySettlementType
    },
    getPaySettlementType () {
      http({
        url: http.adornUrl('/sys/pconfig/info/' + 'PAY_SETTLEMENT_CONFIG'),
        method: 'get',
        params: http.adornParams()
      }).then((res) => {
        const data = res && res.data ? JSON.parse(res.data) : {}
        this.SET_PAY_SETTLEMENT_TYPE(data.paySettlementType ? data.paySettlementType : 0)
      })
    }
  }
})
